# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=libqtxdg
pkgver=3.12.0
pkgrel=0
pkgdesc="Qt implementation of freedesktop.org xdg specifications"
url="https://github.com/lxqt/libqtxdg"
arch="all"
license="LGPL-2.0-or-later"
depends="gtk+3.0"
makedepends="
	cmake samurai lxqt-build-tools qt5-qtbase-dev
	qt5-qtsvg-dev glib-dev
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev"
source="https://github.com/lxqt/libqtxdg/releases/download/$pkgver/libqtxdg-$pkgver.tar.xz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DBUILD_TESTS=Yes \
		$CMAKE_CROSSOPTS .
	cmake --build build

}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run cmake --build build --target test
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install

	mkdir -p "$pkgdir"/usr/lib
	mv "$pkgdir"/usr/share/cmake "$pkgdir"/usr/lib
}

sha512sums="
9db46b0dddb027a24e1c19a2e3679014735cc246f15d32bc5fb9e778cd7d8fb57c9b105f819091308002f0a2eff8269920ecc0d7bd5ce8a01fbaf0b37e61a76e  libqtxdg-3.12.0.tar.xz
"
